//-----------------------------------------------------------------------------------
#ifndef __CMYCOMBOBOX_H__
#define __CMYCOMBOBOX_H__
//-----------------------------------------------------------------------------------
#include <QtGui>
#include <QHBoxLayout>
#include <QWidget>
#include <QLineEdit>
#include <QPushButton>
#include <QtDesigner/QDesignerExportWidget>
#include <QPixmap>
#include "CChampText.h"
//-----------------------------------------------------------------------------------
#ifndef DESIGNER_CONTROL
#define DESIGNER_EXPORT	QDESIGNER_WIDGET_EXPORT
#else
#define DESIGNER_EXPORT
#endif //DESIGNER_CONTROL
//-----------------------------------------------------------------------------------
class DESIGNER_EXPORT CMyComboBox : public QWidget, public CChampText
{
	Q_OBJECT
#ifndef DESIGNER_CONTROL
	Q_PROPERTY(QString champ READ getChamp WRITE setChamp)
	Q_PROPERTY(QString table READ getTable WRITE setTable)
	Q_PROPERTY(CCommun::EDataType dataType READ getDataType WRITE setDataType)
	Q_PROPERTY(QString champRemp READ getChampRemp WRITE setChampRemp)
	Q_PROPERTY(QString tableRemp READ getTableRemp WRITE setTableRemp)
	Q_PROPERTY(bool standaloneEnable READ getStandaloneEnable WRITE setStandaloneEnable)
#endif //DESIGNER_CONTROL
	public:
		CMyComboBox(QWidget *parent = 0);
		virtual QString getValue(void);
		virtual void setValue(QVariant value);
		virtual void setStateEnable(bool enable);		
		virtual void setAttribut(EAttribut value);
		virtual void setTextCondition(QString value);
		virtual bool isEmpty(void);
	private:
		QLineEdit *lineEdit;
		QPushButton *pushButton;
		
		//void resizeEvent(QResizeEvent *event);
		QPixmap getImageFromMemory(const unsigned char *data, int len);
	private slots:
		void OnClicked(void);
		void OnTextEdited(QString text);
		void OnEditingFinished(void);
	signals:
		void clicked(CMyComboBox *Sender);
		void textEdited(QString text);
		void editingFinished(void);
		void invokeHelp(CChamp *sender);
	protected:
		void keyPressEvent(QKeyEvent * event);
};
//-----------------------------------------------------------------------------------
#endif //__CMYCOMBOBOX_H__
//-----------------------------------------------------------------------------------
